import functions from './functions.js';
var config = require('./config.js');
function uploadimg(succCallback,errorCallback){
  wx.chooseImage({
      count: 1,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success (res) {
          const tempFilePaths = res.tempFilePaths;
          functions.loadingToast("上传中...");
          wx.uploadFile({
              url: config.Host + 'platform/config/upload', //仅为示例，非真实的接口地址
              filePath: tempFilePaths[0],
              name: 'file',
              formData: {},
              success (res){
                  const data = res.data
                  functions.hideToast();
                  succCallback(data);
              },
              fail(e){
                functions.hideToast();
                  errorCallback(e);
              }
          })
      }
  })
}
export default uploadimg